/// <reference path="./BaseOral.ts" />
namespace wmedu {
    /** 四则运算：先加再除（无括号） */
    export class FourOper_AD extends BaseOral implements IOralCreater {
        create(opt: IOralOpt) {
            let paramArea = opt.paramArea;
            let ops: Enum_OralOp[] = [Enum_OralOp.Add, Enum_OralOp.Div];
            let first = new FourOper_Div();
            let fres = first.create({ blankSide: opt.blankSide, blankStr: opt.blankStr, paramArea: opt.mdParamArea })
            // 得到结果值
            let value = this.mGetRandomInt(paramArea);
            if (value < fres.value) {
                let t = fres.value - value + 1
                value += MathUtil.randomInt(t * 3, t);
            }
            let p2 = value - fres.value;

            let nums: number[] = [p2].concat(fres.nums)
            let str = BuildUtil.getOralStr(opt.blankSide, opt.blankStr, nums, ops, value);
            let res: IOralSide = { nums: nums, ops: ops, value: value, str }
            return res;
        }
    }
}